import React from "react";
import {Image, StyleSheet, View} from "react-native";
import ProcessBar from "./ProcessBar";


type ImageMessageComponentProp = {
    toMe?:number
    uri:string // 图片文件下载路径
}

export default class ImageMessageComponent extends React.Component<ImageMessageComponentProp, any> {
    private bar:ProcessBar|any;

    constructor(props:ImageMessageComponentProp) {
        super(props);
    }

    render() {
        return (
            <View style={{alignSelf:this.props.toMe === 1 ? 'flex-start' : 'flex-end',flexDirection:this.props.toMe === 1 ? 'row' : 'row-reverse'}}>
                <Image  style={imageMessageStyles.image} resizeMode={'contain'}  source={{uri:this.props.uri}}/>
            </View>
        )
    }
}

const imageMessageStyles = StyleSheet.create({
    container: {
    },
    image:{
        borderRadius:8,
        width: 220,
        height: 220
    }
});
